package com.practice.bootdemo.controller;

import com.practice.bootdemo.common.R;
import com.practice.bootdemo.dto.CodeTestDto;
import com.practice.bootdemo.service.AsyncService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author :zhoushunquan
 * @description: 异步测试
 * @create date: 2022-03-24 17:25:33
 */


@RestController
@RequestMapping(value = "asyn")
@Tag(description = "AsyncController", name = "异步测试 信息接口")
public class AsyncController {

    @Autowired
    AsyncService asyncService;

    @Operation(summary = "异常测试")
    @PostMapping(value = "add")
    public R<Integer> add(@RequestBody @Validated(CodeTestDto.Add.class) CodeTestDto codeTestDto) {
        asyncService.async1();
        asyncService.async2();
        return R.ok(1);
    }

}